﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZQNB.Common.Models
{
    public class Nbml
    {
        public Nbml()
        {
            Start = "";
            End = "";
            InnerTags = new List<Nbml>();
        }

        public string Start { get; set; }
        public IList<Nbml> InnerTags { get; set; }
        public string End { get; set; }

        public override string ToString()
        {
            if (InnerTags == null || InnerTags.Count == 0)
            {
                return Start + End;
            }
            StringBuilder sb = new StringBuilder();
            sb.Append(Start);
            foreach (var innerTag in InnerTags)
            {
                sb.Append(innerTag);
            }
            sb.Append(End);
            return sb.ToString();
        }

        public static string MakeTagValue(Nbml nbml)
        {
            return nbml.ToString();
        }
    }
}
